#include"ros/ros.h"
#include"tf2_ros/transform_listener.h"
#include"tf2_ros/buffer.h"
#include"geometry_msgs/PointStamped.h"
#include"tf2_geometry_msgs/tf2_geometry_msgs.h"
int main(int argc, char *argv[])
{
    setlocale(LC_ALL,"");
    ros::init(argc,argv,"elk");
    ros::NodeHandle nh;
    tf2_ros::Buffer buffer;
    tf2_ros::TransformListener listen(buffer);
    geometry_msgs::PointStamped ps;
    ps.header.stamp=ros::Time(0,0);

    ps.header.frame_id="turtle1";
    ps.point.x=3.0;
    ps.point.y=4.0;
    ps.point.z=6.0;
    ros::Duration(6).sleep();
    ros::Rate rate(10);
    while(ros::ok())
    {
        geometry_msgs::PointStamped ps_out;
        ps_out=buffer.transform(ps,"world");
        ROS_INFO("转换后的坐标系：（%.2f,%.2f,%.2f)参考的坐标系:%.2f",
                            ps_out.point.x,
                            ps_out.point.y,
                            ps_out.point.z,
                            ps_out.header.frame_id.c_str()
                            );
        rate.sleep();
        ros::spinOnce();
    }
    
    return 0;
}
